package cn.com.digitalnet.ad.util.schedule;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.com.digitalnet.ad.util.email.MimeMailService;
import cn.com.digitalnet.ad.util.email.SimpleMailService;

/**
 * 用于发送email的组件
 * @author qidafang
 */
@Component
public class EmailSender {
	@Autowired SimpleMailService simpleMailService;
	@Autowired MimeMailService mimeMailService;
	
	public void sendSimpleEmail(){
		simpleMailService.sendMail("龙神");
	}
	
	public void sendMimeEmail(){
		mimeMailService.sendMail("龙神");
	}

	public void sendEmail() {
		if(Math.random() > 1){
			sendSimpleEmail();
		}else{
			sendMimeEmail();
		}
	}
}
